package com.zzl.bonds.ticket.constant.status;

/**
 * @author : spp
 * @date : 2022/2/18 11:11
 */
public enum ApproveStatusEnum {

    /**
     * 开单待复核
     */
    START(0, "审批中", "提交审批中"),
    PARENT_ENTERPRISE_REJECT(10, "开单方驳回", "复核未通过"),
    PARENT_ENTERPRISE_PASS(11, "开单方通过", "待审批"),
    PLATFORM_REJECT(20, "平台驳回", "审批未通过"),
    PLATFORM_PASS(21, "平台通过", "待签收"),
    RECEIVE_ENTERPRISE_REJECT(30, "签收方驳回", "已被拒收"),
    RECEIVE_ENTERPRISE_PASS(31, "签收方通过", ""),
    CANCEL(40, "已被撤销", "已被撤销");

    private Integer code;
    private String name;
    private String description;



    ApproveStatusEnum(Integer code, String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }

    /**
     * 获取描述
     *
     * @param approveStatus 审批code
     * @return 描述
     */
    public static String getHandInfo(Integer approveStatus) {
        for (ApproveStatusEnum value : ApproveStatusEnum.values()) {
            if (value.code.equals(approveStatus)) {
                return value.description;
            }
        }
        return null;
    }

    /**
     * 通过code获取枚举对象
     *
     * @param code code值
     * @return 枚举对象
     */
    public static ApproveStatusEnum getStatus(Integer code) {
        for (ApproveStatusEnum value : ApproveStatusEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }


}
